#include "Ability.h"

 Ability::Ability()
 {
 }
Ability::~Ability()
{     
}
Ability::Ability(float cast, int cost, bool instant)
{
    castTime = cast;
    ammo = cost;
    isInstant = instant;
    isBasicAttack = false;
}

Ability::Ability(float cast, int cost, bool instant, bool basic)
{
    castTime = cast;
    ammo = cost;
    isInstant = instant;
    isBasicAttack = basic;
}

Ability::Ability(float cast, int cost, bool instant, float coeff1, float stdMin1, float stdMax1, int numTicks1, float coeff2, float stdMin2, float stdMax2, int numTicks2)
{
    castTime = cast;
    ammo = cost;
    isInstant = instant;
    isBasicAttack = false;
    effect1.setValues(coeff1, stdMin1, stdMax1, numTicks1);
    effect2.setValues(coeff2, stdMin2, stdMax2, numTicks2);
}

Ability::Ability(float cast, int cost, bool instant, float coeff1, float stdMin1, float stdMax1, int numTicks1, double amountModPercent1, float coeff2, float stdMin2, float stdMax2, int numTicks2)
{
    castTime = cast;
    ammo = cost;
    isInstant = instant;
    isBasicAttack = false;
    effect1.setValues(coeff1, stdMin1, stdMax1, numTicks1, amountModPercent1);
   effect2.setValues(coeff2, stdMin2, stdMax2, numTicks2);
}

Ability::Ability(float cast, int cost, bool instant, float coeff1, float stdMin1, float stdMax1, int numTicks1, double amountModPercent1, float coeff2, float stdMin2, float stdMax2, int numTicks2,  double amountModPercent2)
{
    castTime = cast;
    ammo = cost;
    isInstant = instant;
    isBasicAttack = false;
    effect1.setValues(coeff1, stdMin1, stdMax1, numTicks1, amountModPercent1);
    effect2.setValues(coeff2, stdMin2, stdMax2, numTicks2, amountModPercent2);
}

Ability::Ability(float cast, int cost, bool instant, float coeff1, float stdMin1, float stdMax1, int numTicks1, double amountModPercent1)
{
    castTime = cast;
    ammo = cost;
    isInstant = instant;
    isBasicAttack = false;
    effect1.setValues(coeff1, stdMin1, stdMax1, numTicks1, amountModPercent1);
    effect2.setValues(0, 0, 0);
}

Ability::Ability(float cast, int cost, bool instant, float coeff1, float stdMin1, float stdMax1)
{
    castTime = cast;
    ammo = cost;
    isInstant = instant;
    isBasicAttack = false;
    effect1.setValues(coeff1, stdMin1, stdMax1);
    effect2.setValues(0, 0, 0);
}

double Ability::getAmmo()
{
    return (ammo);
}

double Ability::getCastTime(float speed)
{
    float temp;
    if (isInstant == false)
    {
        temp = castTime * speed;
    }
    else
    {
        temp = castTime;
    }
    return temp;
}
double Ability::getHealing(float bonusHealing)
{
    healing = effect1.getHealing(bonusHealing) + effect2.getHealing(bonusHealing);
    return healing;
}

bool Ability::getIsInstant()
{
    return isInstant;
}

double Ability::getDamage(double bonusDamage, double MH_max, double MH_min, double OH_max, double OH_min)
{
    if(isBasicAttack==true){
        damage = effect1.getDamage( bonusDamage, MH_max, MH_min, OH_max, OH_min, isBasicAttack);
    } else{
    damage = effect1.getDamage( bonusDamage, MH_max, MH_min, OH_max, OH_min, isBasicAttack)
            + effect2.getDamage(bonusDamage, MH_max, MH_min, OH_max, OH_min, isBasicAttack);
    }
    return damage;
}

void Ability::setValues(double cast, int cost, bool instant)
{
    castTime = cast;
    ammo = cost;
    isInstant = instant;
}
